package com.yzion.baselib.activity

import android.view.LayoutInflater
import androidx.viewbinding.ViewBinding

/**
 * 支持使用ViewBinding，子类通过binding.view来获得控件的引用
 */
abstract class BaseBindingActivity<VB : ViewBinding> : BaseActivity() {

    lateinit var binding: VB

    final override fun initViewBinding(inflater: LayoutInflater): ViewBinding {
        binding = getViewBinding(inflater)
        return binding
    }

    final override fun getLayoutId(): Int {
        return 0
    }

    /**
     * 实例化对应的ViewBinding
     */
    abstract fun getViewBinding(inflater: LayoutInflater): VB

}